package com.itheima.Service.Impl;


import com.itheima.Mapper.SetMealDao;
import com.itheima.Service.SetMealService;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SetMealServiceImpl implements SetMealService {
    @Autowired
    private SetMealDao setMealDao;


    @Override
    public List<Setmeal> getSetmeal() {
        List<Setmeal>result=setMealDao.getSetmeal();
        return result;
    }


    //TODO 需要多表查询
    @Override
    public Setmeal findById(Integer id) {

        return setMealDao.findById(id);


//        Setmeal setmeal=setMealDao.findById(id);
//        List<Integer>checkGroupIds =setMealDao.findCheckGroupIdsBySetmealId(id);
//        List<CheckGroup>checkGroups=setMealDao.selectByCheckgroupIds(checkGroupIds);
//
//        for (CheckGroup checkGroup : checkGroups) {
//            List<Integer>checkItemIds=setMealDao.findCheckItemIdsByCheckGroupId(checkGroup.getId());
//            List<CheckItem>checkItem=setMealDao.selectBycheckItemIds(checkItemIds);
//            checkGroup.setCheckItems(checkItem);
//        }
//
//        setmeal.setCheckGroups(checkGroups);
//        return setmeal;

    }


}
